//
//  RegisterThreeViewController.m
//  HTP
//
//  Created by 陈钱钿 on 15/11/4.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "RegisterThreeViewController.h"
#define kBorder 20
@interface RegisterThreeViewController ()

@end

@implementation RegisterThreeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self addCustomTitleWithTitle:@"设置密码"];
    
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 20, 15, 20);
    [back setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(doBack) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backItem;
    
    [self initUI];
}

//TODO:绘制UI
- (void)initUI {
    UITextField *pwd = [[UITextField alloc] initWithFrame:CGRectMake(kBorder, 2*kBorder, ScreenWidth-2*kBorder, 38)];
    pwd.borderStyle = UITextBorderStyleRoundedRect;
    pwd.placeholder = @"请输入密码";
    pwd.secureTextEntry = YES;
    [self.view addSubview:pwd];
    
    UITextField *confirmPwd = [[UITextField alloc] initWithFrame:CGRectMake(kBorder, CGRectGetMaxY(pwd.frame)+2*kBorder, ScreenWidth-2*kBorder, 38)];
    confirmPwd.borderStyle = UITextBorderStyleRoundedRect;
    confirmPwd.placeholder = @"请再次输入密码";
    confirmPwd.secureTextEntry = YES;
    [self.view addSubview:confirmPwd];
    
    UIButton *confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake(kBorder, CGRectGetMaxY(confirmPwd.frame)+2*kBorder, ScreenWidth-2*kBorder, 35)];
    [confirmBtn setBackgroundImage:[UIImage imageNamed:@"confirm2"] forState:UIControlStateNormal];
    [self.view addSubview:confirmBtn];
}

- (void)doBack {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
